<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>招聘信息列表</title>
    <script type="text/javascript" th:src="@{/jquery.3.6.0.js}"></script>
    <script type="text/javascript" th:inline="javascript">
        /*<![CDATA[*/
        ctxPath = /*[[@{/}]]*/ '';
        /*]]>*/
    </script>　
</head>
<body>
<table border="1">
    <thead>
    <tr>
        <th>id</th>
        <th>name</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="job:${jobList}">
        <td th:text="${job.id}"></td>
        <td th:text="${job.name}"></td>
        <td>
            <button onclick="doClick('login')">登录</button>
            <button onclick="doClick('click')">点击</button>
            <button onclick="doClick('jobCollect')">收藏</button>
            <button onclick="doClick('cvSend')">投简历</button>
            <button onclick="doClick('cvUpload')">上传简历</button>
        </td>
    </tr>
    </tbody>
</table>
</body>
<script>
    function doClick(type) {
        $.ajax({
            url: 'http://192.168.174.138:80/log',
            type: 'POST',
            // contentType防止跨域
            contentType: "application/x-www-form-urlencoded",
            dataType: "json",
            data: JSON.stringify({
                userId: 'wsz',
                actTime: new Date(),
                action: type,
                jobCode: 'wszJobCode'
            }),
            success: function (res) {
                console.log(res)
            },
            error: function (res) {
                alert(res)
            }
        });
    }
</script>
</html>